﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Globalization;




namespace FXnaInfrastructure
{
    [Serializable]
    public class SettingInfo
    {
        /// <summary>
        /// The Preferred Culture
        /// </summary>
        public CultureInfo PreferredCulture;

        //public string CurrentTheme;

        /// <summary>
        /// Creates a new instance of this class
        /// </summary>
        public SettingInfo()
        {
            PreferredCulture = System.Globalization.CultureInfo.CurrentCulture;

            //CurrentTheme = "WhistlerBlue";

        }




        List<History> _recentFile = new List<History>();

        public List<History> RecentFile
        {
            get { return _recentFile; }
            set { _recentFile = value; }
        }


        public void AddHistory(History h)
        {


            ///默认我们只取6条最近的项目
            History old;
            if ((old = this._recentFile.FirstOrDefault<History>(his => his.FilePath == h.FilePath)) != null)
            {
                _recentFile.Remove(old);
                _recentFile.Add(h);


            }
            else
            {

                if (this._recentFile.Count == 10)
                {
                    _recentFile.RemoveAt(0);
                    _recentFile.Add(h);
                }
                else
                {
                    _recentFile.Add(h);
                }

            }


        }



    }
}
